//
//  UIImage+Customer.h
//  Moon4.0
//
//  Created by kklink on 14/10/23.
//  Copyright (c) 2014年 kklink. All rights reserved.
//

#import <UIKit/UIKit.h>
// 头像大小以及头像与其他控件的距离
static CGFloat const HAvatarImageSize = 40.0f;
static CGFloat const HAlbumAvatorSpacing = 15.0f;

typedef NS_ENUM(NSInteger, MessageAvatorType) {
    MessageAvatorTypeNormal = 0,
    MessageAvatorTypeSquare,
    MessageAvatorTypeCircle
};

@interface UIImage (Customer)

/**
 *  保存相册
 *
 *  @param completeBlock 成功回调
 *  @param completeBlock 出错回调
 */
-(void)savedPhotosAlbum:(void(^)())completeBlock failBlock:(void(^)())failBlock;



- (UIImage *)blurryImageWithBlurLevel:(CGFloat)blur; //获得图片模糊化之后的图片
- (UIImage *)imageFromView:(UIView *)theView atFrame:(CGRect)r; //获得某个范围内的屏幕图像

- (UIImage *)createRoundedWithRadius:(CGFloat)radius;
//+ (UIImage *)bubbleImageViewForType:(BubbleMessageType)type
//                              style:(BubbleImageViewStyle)style
//                          meidaType:(BubbleMessageMediaType)mediaType;

+ (UIImage *)createImageWithColor:(UIColor *)color;


+ (UIImage *)avatarImageNamed:(UIImage *)originImage
            messageAvatorType:(MessageAvatorType)type;

+ (UIImage*) thumbnailImageForVideo:(NSURL *)videoURL atTime:(NSTimeInterval)time;

@end



@interface UIImage (Cut)

/*
 *  圆形图片
 */
@property (nonatomic,strong,readonly) UIImage *roundImage;


/**
 *  从给定UIView中截图：UIView转UIImage
 */
+(UIImage *)cutFromView:(UIView *)view;

/**
 *  直接截屏
 */
+(UIImage *)cutScreen;
/**
 *  从给定UIImage和指定Frame截图：
 */
-(UIImage *)cutWithFrame:(CGRect)frame;

@end
